<!DOCTYPE html>
<html lang="en" xmlns:zxw="http://www.w3school.com.cn" xmlns:njzxw="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>首页</title>
    <link rel="stylesheet" href="../../../js/common/layui/css/layui.css">
    <link rel="stylesheet" href="../../../css/common/animate.css" />
    <link rel="stylesheet" href="../../../css/common/common.css" />
</head>
<body class="layout-zxw" >
    <form action="" id="logInfoform" class="layui-form layui-fluid" lay-filter="logInfofilter" >
        <div class="layui-form-item row">
            <zxw:input colclass="layui-inline" id="oper_name" type="text" parcel="true" placeholder="请输入用户名称" parcelName="用户名称" parcelclass="col-xs-12" inline="false" value="" maxlength="10" name="oper_name" lay_verify="" class="" ></zxw:input>
            <zxw:input colclass="layui-inline" id="type" type="text" parcel="true" placeholder="请输入访问类型" parcelName="访问类型" parcelclass="col-xs-12" inline="false" value="" maxlength="10" name="type" lay_verify="" class="" ></zxw:input>
            <zxw:input colclass="layui-inline" id="oper_date" type="text" parcel="true" placeholder="请输入操作时间" parcelName="操作时间" parcelclass="col-xs-12" inline="false" value="" maxlength="10" name="oper_date" lay_verify="" class="" ></zxw:input>
            <zxw:input colclass="layui-inline" id="state" type="text" parcel="true" placeholder="请输入请求状态" parcelName="请求状态" parcelclass="col-xs-12" inline="false" value="" maxlength="10" name="state" lay_verify="" class="" ></zxw:input>
            <zxw:input colclass="layui-inline" id="oper_remark" type="text" parcel="true" placeholder="请输入请求备注信息" parcelName="请求备注信息" parcelclass="col-xs-12" inline="false" value="" maxlength="10" name="oper_remark" lay_verify="" class="" ></zxw:input>
            <zxw:input colclass="layui-inline" id="oper_url" type="text" parcel="true" placeholder="请输入请求地址" parcelName="请求地址" parcelclass="col-xs-12" inline="false" value="" maxlength="10" name="oper_url" lay_verify="" class="" ></zxw:input>
        </div>
        <div class="layui-form-item row">
            <zxw:textarea height="400px" id="request_params" type="text" parcel="true" placeholder="请输入请求参数" parcelName="请求参数" parcelclass="col-xs-12" inline="false" value="" maxlength="10" name="request_params" lay_verify="" class="" ></zxw:textarea>
        </div>
        <div class="layui-form-item row">
            <zxw:textarea height="200px" row="10" id="return_str" type="text" parcel="true" placeholder="请输入返回参数" parcelName="返回参数" parcelclass="col-xs-12" inline="false" value="" maxlength="10" name="return_str" lay_verify="" class="" ></zxw:textarea>
        </div>

    </form>

    <script type="application/javascript" src="../../../js/common/own/own.js?layui,jquery,njzxw,URL" >
        njzxw.layui.val({
            url:URL.LOGINFO.QUERYID,
            paramExe:function(data){

                data['request_params'] = formatJson(data['request_params']);
                data['return_str'] = formatJson(data['return_str']);
                return data;
            },
            fun:function(data){
                //存在初始化需要额外处理的在此操作
            }
        });
        njzxw.layui.submit({
            url:URL.LOGINFO.INSERT
        });

        function formatJson(json) {
            if(json == undefined || json == null || json == ''){
                return '';
            }

            var i           = 0,
                len          = 0,
                tab         = "    ",
                targetJson     = "",
                indentLevel = 0,
                inString    = false,
                currentChar = null;


            for (i = 0, len = json.length; i < len; i += 1) {
                currentChar = json.charAt(i);

                switch (currentChar) {
                    case '{':
                    case '[':
                        if (!inString) {
                            targetJson += currentChar + "\n" + repeat(tab, indentLevel + 1);
                            indentLevel += 1;
                        } else {
                            targetJson += currentChar;
                        }
                        break;
                    case '}':
                    case ']':
                        if (!inString) {
                            indentLevel -= 1;
                            targetJson += "\n" + repeat(tab, indentLevel) + currentChar;
                        } else {
                            targetJson += currentChar;
                        }
                        break;
                    case ',':
                        if (!inString) {
                            targetJson += ",\n" + repeat(tab, indentLevel);
                        } else {
                            targetJson += currentChar;
                        }
                        break;
                    case ':':
                        if (!inString) {
                            targetJson += ": ";
                        } else {
                            targetJson += currentChar;
                        }
                        break;
                    case ' ':
                    case "\n":
                    case "\t":
                        if (inString) {
                            targetJson += currentChar;
                        }
                        break;
                    case '"':
                        if (i > 0 && json.charAt(i - 1) !== '\\') {
                            inString = !inString;
                        }
                        targetJson += currentChar;
                        break;
                    default:
                        targetJson += currentChar;
                        break;
                }
            }
            return targetJson;
        }

        function repeat(s, count) {
            return new Array(count + 1).join(s);
        }
    </script>
</body>
</html>